package cc.catface.service.admin;

import cc.catface.common.output.ResultBody;
import cc.catface.dao.admin.mapper.AdLabelMapperServiceImpl;
import cc.catface.dao.admin.pojo.AdLabel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AdLabelServiceImpl implements AdLabelService {
    @Autowired
    private AdLabelMapperServiceImpl labelMapperService;

    @Override
    public ResultBody add(AdLabel label) {
        boolean add = labelMapperService.save(label);
        if (add) return ResultBody.success();
        return ResultBody.error("新增标签失败");
    }

    @Override
    public ResultBody update(AdLabel label) {
        boolean update = labelMapperService.updateById(label);
        if (update) return ResultBody.success();
        return ResultBody.error("修改标签失败");
    }

    @Override
    public ResultBody list() {
        return ResultBody.success(labelMapperService.list());
    }
}
